# Contributor: viest <dev@service.viest.me>
# Maintainer: Chitao.Gao <neeke@php.net>
pkgname=php7-pecl-seaslog
_pkgreal=seaslog
pkgver=2.1.0
pkgrel=1
pkgdesc="An effective, fast, stable log extension for PHP."
url="https://pecl.php.net/package/SeasLog"
arch="all"
license="PHP-3.01"
depends="php7-json"
makedepends="php7-dev re2c"
source="$pkgname-$pkgver.tar.gz::https://pecl.php.net/get/SeasLog-$pkgver.tgz
	fix-32-bits-287.patch"
builddir="$srcdir"/SeasLog-$pkgver

# FIXME: on s390x 10 tests broken https://github.com/SeasX/SeasLog/issues/292
case "$CARCH" in
	mips64|s390x) options="$options !check";;
esac

build() {
	phpize7
	./configure \
		--prefix=/usr \
		--with-php-config=/usr/bin/php-config7
	make
}

check() {
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test \
		PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=/usr/lib/php7/modules/json.so \
		-d extension=modules/$_pkgreal.so"
	php7 -d extension="$builddir"/modules/$_pkgreal.so --ri $_pkgreal
}

package() {
	make INSTALL_ROOT="$pkgdir/" install
	install -d "$pkgdir"/etc/php7/conf.d
	echo "extension=$_pkgreal.so" > "$pkgdir"/etc/php7/conf.d/$_pkgreal.ini
}

sha512sums="f9342cda45b302f4bb8292a914f13df056ac3c6e23b54a99054df8c6387bcffa7e5787c56b32e48024720b5007af7e96a25dd7e3d842e171cef95576a674ff2e  php7-pecl-seaslog-2.1.0.tar.gz
3bffdbfcb1f9db311281a3707dfdb052556b706d86855335ea2bf95288b1fa7708b9b7a8623350afc2a1f6dc46237c43ad13a8469618d06a8b4c5af41171537a  fix-32-bits-287.patch"
